<?
	$wp_db = $_POST['wp_db'];
	$wp_db_user = $_POST['wp_db_user'];
	$wp_db_pass = $_POST['wp_db_pass'];
	$wp_db_host = $_POST['wp_db_host'];
	$wp_db_prefix = $_POST['wp_db_prefix'];
	
	function use_db_wordpress() {
		
		global $wp_db, $wp_db_user, $wp_db_pass, $wp_db_host, $wp_db_prefix;

		$wp_connect = mysql_connect($wp_db_host, $wp_db_user, $wp_db_pass);

		if (!$wp_connect) {
			echo "<p>Unable to connect to the database server for " . $wp_db . " at this time.</p>" . mysql_error();
			exit();

		} else {
			mysql_select_db($wp_db, $wp_connect);

			if (!mysql_select_db($wp_db) ) {
				echo "<p>Unable to locate the database " . $wp_db . " at this time.</p>" . mysql_error();
				exit();
			}
		}
	}

	$wp_users = $wp_db_prefix . "users";
	$wp_usermeta = $wp_db_prefix . "usermeta";
	$wp_posts = $wp_db_prefix . "posts";
	$wp_links = $wp_db_prefix . "links";
	$wp_linkcategories = $wp_db_prefix . "linkcategories";
	$wp_comments = $wp_db_prefix . "comments";
	$wp_post2tag = $wp_db_prefix . "post2tag";
	$wp_tags = $wp_db_prefix . "tags";
	$wp_post2cat = $wp_db_prefix . "post2cat";
	$wp_categories = $wp_db_prefix . "categories";
	
	include('import_wp_users.php');
	include('import_wp_posts.php');	
	include('import_wp_convert_page_parents.php');
	include('import_wp_tags.php');
	include('import_wp_convert_tags.php');
	include('import_wp_comments.php');
	include('import_wp_links.php');
	
	$drop_wp_table = mysql_query("ALTER TABLE `$drizzo_posts` DROP `import_id`");
	if($drop_wp_table) {
		echo "<p>WordPress clean up is finished.</p>";
	}
?>